import { CareerConfig } from "../../../resource/CareerConfig";
import { ECareer } from "../../../../../Message/Public/ECareer";
import { Cache } from "../../../cache/Cache";
import { ImagesConst } from "../../../resource/ImagesConst";
import { Language } from "../../../../../extend/language/Language";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
type int = number;
//class CareerUtil
    
    export  class CareerUtil
    {
        

        public static getEquipCareerArray(arg1: int): Array<any>
        {
            var loc2=0;
            var loc1=[];
            var loc3=0;
            while (loc3 < CareerUtil.allCareer.length) 
            {
                loc2 = CareerUtil.allCareer[loc3] as int;
                if ((arg1 & loc2) != 0) 
                {
                    loc1.push(loc2);
                }
                ++loc3;
            }
            return loc1;
        }

        public static getCareerName(arg1: int): string
        {
            var loc1=CareerConfig.instance.getInfoByCode(arg1);
            if (loc1) 
            {
                return loc1.name;
            }
            return "";
        }

        public static getEquipCareerName(arg1: int): string
        {
            var loc3=0;
            var loc1="";
            var loc2=CareerUtil.getEquipCareerArray(arg1);
            var loc4=null;
            var loc5=loc2.length;
            var loc6=0;
            while (loc6 < loc5) 
            {
                loc3 = loc2[loc6] as int;
                if (loc4 = CareerConfig.instance.getInfoByCode(loc3)) 
                {
                    if (loc6 != (loc2.length - 1)) 
                    {
                        loc1 = loc1 + loc4.name;
                    }
                    else 
                    {
                        if (loc6 != 0) 
                        {
                            loc1 = loc1 + "、";
                        }
                        loc1 = loc1 + loc4.name;
                    }
                }
                ++loc6;
            }
            return loc1;
        }

        public static isCareerSuit(arg1: int, arg2: int): Boolean
        {
            var loc1=CareerUtil.getEquipCareerArray(arg1);
            return arg1 == ECareer._ECareerNo || !(loc1.indexOf(arg2) == -1);
        }

        public static isMagicCareer(arg1: int=-1): Boolean
        {
            if (arg1 == -1) 
            {
                arg1 = Cache.instance.role.entityInfo.career;
            }
            var loc1=arg1;
            switch (loc1) 
            {
                case ECareer._ECareerFireMage: case ECareer._ECareerDoctor: case ECareer._ECareerIceMage: case ECareer._ECareerPriest:
                {
                    return true;
                }
            }
            return false;
        }

        public static isPhysicalCareer(arg1: int=-1): Boolean
        {
            if (arg1 == -1) 
            {
                arg1 = Cache.instance.role.entityInfo.career;
            }
            var loc1=arg1;
            switch (loc1) 
            {
                case ECareer._ECareerArcher: case ECareer._ECareerWarrior: case ECareer._ECareerWarriorD: case ECareer._ECareerStabber:
                {
                    return true;
                }
            }
            return false;
        }

        public static isNewPlayerOrNoCareer(arg1: int): Boolean
        {
            if (arg1 == ECareer._ECareerNewPlayer) 
            {
                return true;
            }
            if (arg1 == ECareer._ECareerNo) 
            {
                return true;
            }
            return false;
        }

        public static isGradeCareer(arg1: int=-1): Boolean
        {
            if (arg1 == -1) 
            {
                arg1 = Cache.instance.role.entityInfo.career;
            }
            var loc1=arg1;
            switch (loc1) 
            {
                case ECareer._ECareerWarriorD: case ECareer._ECareerStabber: case ECareer._ECareerIceMage: case ECareer._ECareerPriest:
                {
                    return true;
                }
            }
            return false;
        }

        public static getOtherGradeCareer(arg1: int, arg2: int): Array<any>
        {
            var loc1=[];
            CareerUtil.addOtherCareer(arg1, arg2, ECareer._ECareerWarriorD, loc1);
            CareerUtil.addOtherCareer(arg1, arg2, ECareer._ECareerStabber, loc1);
            CareerUtil.addOtherCareer(arg1, arg2, ECareer._ECareerIceMage, loc1);
            CareerUtil.addOtherCareer(arg1, arg2, ECareer._ECareerPriest, loc1);
            return loc1;
        }

        /* internal  */static addOtherCareer(arg1: int, arg2: int, arg3: int, arg4: Array<any>): void
        {
            if (arg1 == arg3) 
            {
                return;
            }
            if (arg2 == arg3) 
            {
                return;
            }
            arg4.push(arg3);
            return;
        }

        public static getGradeCareer(arg1: int=-1): int
        {
            if (arg1 == -1) 
            {
                arg1 = Cache.instance.role.entityInfo.career;
            }
            var loc1=arg1;
            switch (loc1) 
            {
                case ECareer._ECareerWarrior:
                {
                    return ECareer._ECareerWarriorD;
                }
                case ECareer._ECareerArcher:
                {
                    return ECareer._ECareerStabber;
                }
                case ECareer._ECareerFireMage:
                {
                    return ECareer._ECareerIceMage;
                }
                case ECareer._ECareerDoctor:
                {
                    return ECareer._ECareerPriest;
                }
            }
            return arg1;
        }

        public static getBaseCareer(arg1: int=-1): int
        {
            if (arg1 == -1) 
            {
                arg1 = Cache.instance.role.entityInfo.career;
            }
            var loc1=arg1;
            switch (loc1) 
            {
                case ECareer._ECareerWarriorD:
                {
                    return ECareer._ECareerWarrior;
                }
                case ECareer._ECareerStabber:
                {
                    return ECareer._ECareerArcher;
                }
                case ECareer._ECareerIceMage:
                {
                    return ECareer._ECareerFireMage;
                }
                case ECareer._ECareerPriest:
                {
                    return ECareer._ECareerDoctor;
                }
            }
            return arg1;
        }

        public static getCareerImgName(arg1: int): string
        {
            var loc1=ImagesConst.CareerArcher;
            arg1 = Math.abs(arg1);
            var loc2=arg1;
            switch (loc2) 
            {
                case ECareer._ECareerWarrior:
                {
                    loc1 = ImagesConst.CareerWarrior;
                    break;
                }
                case ECareer._ECareerWarriorD:
                {
                    loc1 = ImagesConst.CareerWarriorD;
                    break;
                }
                case ECareer._ECareerArcher:
                {
                    loc1 = ImagesConst.CareerArcher;
                    break;
                }
                case ECareer._ECareerStabber:
                {
                    loc1 = ImagesConst.CareerStabber;
                    break;
                }
                case ECareer._ECareerFireMage:
                {
                    loc1 = ImagesConst.CareerFireMage;
                    break;
                }
                case ECareer._ECareerIceMage:
                {
                    loc1 = ImagesConst.CareerIceMage;
                    break;
                }
                case ECareer._ECareerDoctor:
                {
                    loc1 = ImagesConst.CareerDoctor;
                    break;
                }
                case ECareer._ECareerPriest:
                {
                    loc1 = ImagesConst.CareerPriest;
                    break;
                }
            }
            return loc1;
        }

        public static getScecondCareerImgURL(arg1: int): string
        {
            var loc1="";
            arg1 = Math.abs(arg1);
            var loc2=arg1;
            switch (loc2) 
            {
                case ECareer._ECareerWarriorD:
                {
                    loc1 = ImagesConst.SecondCareerBg_W + ".swf";
                    break;
                }
                case ECareer._ECareerStabber:
                {
                    loc1 = ImagesConst.SecondCareerBg_Y + ".swf";
                    break;
                }
                case ECareer._ECareerPriest:
                {
                    loc1 = ImagesConst.SecondCareerBg_T + ".swf";
                    break;
                }
                case ECareer._ECareerIceMage:
                {
                    loc1 = ImagesConst.SecondCareerBg_F + ".swf";
                    break;
                }
            }
            return loc1;
        }

        public static getGradeCareerDesc(arg1: int): string
        {
            if (!CareerUtil.isGradeCareer(arg1)) 
            {
                return "";
            }
            var loc1=arg1;
            switch (loc1) 
            {
                case ECareer._ECareerWarriorD:
                {
                    return Language.getString(80242);
                }
                case ECareer._ECareerStabber:
                {
                    return Language.getString(80243);
                }
                case ECareer._ECareerPriest:
                {
                    return Language.getString(80244);
                }
                case ECareer._ECareerIceMage:
                {
                    return Language.getString(80245);
                }
            }
            return "";
        }

        public static getOthersGradeCareer(arg1: int): Array<any>
        {
            var loc1=[ECareer._ECareerWarriorD, ECareer._ECareerStabber, ECareer._ECareerPriest, ECareer._ECareerIceMage];
            var loc2=arg1;
            switch (loc2) 
            {
                case ECareer._ECareerWarriorD: case ECareer._ECareerWarrior:
                {
                    loc1.splice(0, 1);
                    break;
                }
                case ECareer._ECareerStabber: case ECareer._ECareerArcher:
                {
                    loc1.splice(1, 1);
                    break;
                }
                case ECareer._ECareerPriest: case ECareer._ECareerDoctor:
                {
                    loc1.splice(2, 1);
                    break;
                }
                case ECareer._ECareerIceMage: case ECareer._ECareerFireMage:
                {
                    loc1.splice(3, 1);
                    break;
                }
            }
            return loc1;
        }

        public static getSumCareer(arg1: int=-1): int
        {
            if (arg1 == -1) 
            {
                arg1 = Cache.instance.role.entityInfo.career;
            }
            var loc1=arg1;
            switch (loc1) 
            {
                case ECareer._ECareerWarrior: case ECareer._ECareerWarriorD:
                {
                    return ECareer._ECareerWarrior + ECareer._ECareerWarriorD;
                }
                case ECareer._ECareerArcher: case ECareer._ECareerStabber:
                {
                    return ECareer._ECareerArcher + ECareer._ECareerStabber;
                }
                case ECareer._ECareerFireMage: case ECareer._ECareerIceMage:
                {
                    return ECareer._ECareerFireMage + ECareer._ECareerIceMage;
                }
                case ECareer._ECareerDoctor: case ECareer._ECareerPriest:
                {
                    return ECareer._ECareerDoctor + ECareer._ECareerPriest;
                }
            }
            return arg1;
        }

        public static getSkillColor(arg1: int=-1): uint
        {
            if (arg1 == -1) 
            {
                arg1 = Cache.instance.role.entityInfo.career;
            }
            arg1 = CareerUtil.getBaseCareer(arg1);
            return CareerUtil.SkillColor[arg1];
        }

        public static getSkillColorString(arg1: int=-1): string
        {
            if (arg1 == -1) 
            {
                arg1 = Cache.instance.role.entityInfo.career;
            }
            arg1 = CareerUtil.getBaseCareer(arg1);
            return CareerUtil.SkillColorStr[arg1];
        }

        public static getCareerColorString(arg1: int=-1): string
        {
            if (arg1 == -1) 
            {
                arg1 = Cache.instance.role.entityInfo.career;
            }
            arg1 = CareerUtil.getBaseCareer(arg1);
            return CareerUtil.CareerColorStr[arg1];
        }

        public static getCareerIconBmd(arg1: int=-1): Object /* flash.display.BitmapData */
        {
            if (arg1 == -1) 
            {
                arg1 = Cache.instance.role.entityInfo.career;
            }
            var loc1=arg1;
            switch (loc1) 
            {
                case ECareer._ECareerWarriorD: case ECareer._ECareerWarrior:
                {
                    return GlobalClass.getBitmapData(ImagesConst.CareerIcon_W);
                }
                case ECareer._ECareerStabber: case ECareer._ECareerArcher:
                {
                    return GlobalClass.getBitmapData(ImagesConst.CareerIcon_Y);
                }
                case ECareer._ECareerIceMage: case ECareer._ECareerFireMage:
                {
                    return GlobalClass.getBitmapData(ImagesConst.CareerIcon_F);
                }
                case ECareer._ECareerPriest: case ECareer._ECareerDoctor:
                {
                    return GlobalClass.getBitmapData(ImagesConst.CareerIcon_T);
                }
            }
            return null;
        }

        
        {
            CareerUtil.allCareer = [0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048];
        }

        /* internal */ static /* const */SkillColor: Object={"1": 16776960, "2": 16776960, "4": 16776960, "8": 16776960};

        /* internal */ static /* const */SkillColorStr: Object={"1":"#ffff00", "2":"#ffff00", "4":"#ffff00", "8":"#ffff00"};

        /* internal */ static /* const */CareerColorStr: Object={"1":"#fff200", "2":"#29caff", "4":"#f26522", "8":"#ff00e9"};

        public static /* var */allCareer: Array<any>;
    }
